/**
 * 数据库配置
 */
const mongoose = require('mongoose')
const config = require('./index')
const log4js = require('./../utils/log4j')
mongoose.connect(config.SQL_URL, {
  useNewUrlParser: true,
  useUnifiedTopology: true,
})
mongoose.set('useFindAndModify', false)

const db = mongoose.connection

db.on('error', () => {
  log4js.error('***数据库链接错误***')
})

db.once('open', () => {
  log4js.info('***数据库链接成功***')
})
